/**
 * Title: Hyperbolic engine
 * Description: jFamilyTree Engine
 * Version: provider
 * Copyright: (c) 2001-2008
 * Terms of use:see license agreement at http://treebolic.sourceforge.net/en/license.htm
 * Author: Bernard Bou
 * Company: bsys
 * Update: Mon Mar 10 00:00:00 CEST 2008
 */
package jFamilyTree.model;

import java.awt.Color;
import java.awt.Image;


/**
 * Edge interface
 * 
 * Style bits (32):
 * 0000-0000-ttttt-tttt-ffff-ffff-aaaa-aaaa with a=arc t=to-terminator f=from-terminator
 * byte 1 = arc
 * byte 2 = from-terminator
 * byte 3 = to terminator
 * Each byte:
 * SSSS dDsh with S=shape d=dot D=dash s=solid for each aaaa-aaaa, tttt-tttt, ffff-ffff
 * Shapes
 * 0001 = 1 = triangle
 * 0010 = 2 = circle
 * 0011 = 3 = diamond
 * 0100 = 4 = arrow
 * @author Bernard Bou
 */
public interface IEdge
{
	/**
	 * Stroke style bits
	 */
	static public final int STROKEMASK = 0x0e;

	/**
	 * From-terminator mask
	 */
	static public final int FROMMASK = 0x0000ff00;

	/**
	 * To-terminator mask
	 */
	static public final int TOMASK = 0x00ff0000;

	/**
	 * Hidden bit
	 */
	static public final int HIDDEN = 0x1;
	
	//	---- dDs- 	

	/**
	 * Solid style bit
	 */
	static public final byte SOLID = 0x2;

	/**
	 * Dash style bit
	 */
	static public final byte DASH = 0x4;

	/**
	 * Dotted style bit
	 */
	static public final byte DOT = 0x8;

	//	xxxx  ---- mask
	//	0001 ---- triangle 
	//	0010 ---- circle
	//	0011 ---- diamond
	//	0100 ---- arrow
	//	0101 ---- hook

	/**
	 * Terminator mask
	 */
	static public final int SHAPEMASK = 0xf0;

	/**
	 * Triangle terminator style
	 */
	static public final int TRIANGLE = 0x10;

	/**
	 * Circle terminator style
	 */
	static public final int CIRCLE = 0x20;

	/**
	 * Diamond terminator style
	 */
	static public final int DIAMOND = 0x30;

	/**
	 * Arrow terminator style
	 */
	static public final int ARROW = 0x40;
	
	/**
	 * Arrow terminator style
	 */
	static public final int HOOK = 0x50;
	
	// F R O M
	//	0000 0000 0000 0000 ffff ffff <<<< <<<<

	/**
	 * From-terminator shift
	 */
	static public final int FROMSHIFT = 8;

	/**
	 * Solid from-terminator bit
	 */
	static public final int FROMSOLID = SOLID << FROMSHIFT;

	/**
	 * Triangle from-terminator bit
	 */
	static public final int FROMTRIANGLE = TRIANGLE << FROMSHIFT;

	/**
	 * Circle from-terminator bit
	 */
	static public final int FROMCIRCLE = CIRCLE << FROMSHIFT;

	/**
	 * Diamond from-terminator bit
	 */
	static public final int FROMDIAMOND = DIAMOND << FROMSHIFT;

	/**
	 * Arrow from-terminator bit
	 */
	static public final int FROMARROW = ARROW << FROMSHIFT;

	/**
	 * Hook from-terminator bit
	 */
	static public final int FROMHOOK = HOOK << FROMSHIFT;

	// T O 
	//	0000 0000 ttttt tttt <<<< <<<< <<<< <<<<

	/**
	 * To-terminator shift
	 */
	static public final int TOSHIFT = 16;

	/**
	 * Solid to-terminator bit
	 */
	static public final int TOSOLID = SOLID << TOSHIFT;

	/**
	 * Triangle to-terminator bit
	 */
	static public final int TOTRIANGLE = TRIANGLE << TOSHIFT;

	/**
	 * Circle to-terminator bit
	 */
	static public final int TOCIRCLE = CIRCLE << TOSHIFT;

	/**
	 * Diamond to-terminator bit
	 */
	static public final int TODIAMOND = DIAMOND << TOSHIFT;

	/**
	 * Arrow to-terminator bit
	 */
	static public final int TOARROW = ARROW << TOSHIFT;

	/**
	 * Arrow to-terminator bit
	 */
	static public final int TOHOOK = HOOK << TOSHIFT;

	// M E T H O D S
	
	/**
	 * Get from-node
	 * 
	 * @return from-node
	 */
	public INode getFrom();

	/**
	 * Get to-node
	 * 
	 * @return to-node
	 */
	public INode getTo();

	/**
	 * Get edge label
	 * 
	 * @return edge label
	 */
	public String getLabel();

	/**
	 * Get edge color
	 * 
	 * @return edge color
	 */
	public Color getColor();

	/**
	 * Set edge style
	 * 
	 * @return edge style
	 */
	public Integer getStyle();

	/**
	 * Get edge image filename
	 * 
	 * @return path to edge image filename
	 */
	public String getImageFile();

	/**
	 * Get edge image
	 * 
	 * @return edge image
	 */
	public Image getImage();

	/**
	 * Set image file
	 * 
	 * @param thisImage
	 *        edge image
	 */
	public void setImage(Image thisImage);
}
